<?php

namespace common\models\demand;

use Yii;

/**
 * This is the model class for table "{{%demand_content}}".
 *
 * @property int $id
 * @property int $demand_id
 * @property string|null $body
 * @property int $created_at
 * @property int $updated_at
 */
class DemandContent extends \common\db\ActiveRecord {

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%demand_content}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['demand_id', 'created_at', 'updated_at'], 'integer'],
            [['body'], 'string'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'demand_id' => 'Article ID',
            'body' => 'Body',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }

    public function getBodyParagraph() {
        $text = $this->body;
        return explode("\n", $text);
    }

}
